<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改菜品')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-vagetables-edit" th:object="${tzVagetables}">
            <input name="vagetablesId" th:field="*{vagetablesId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">所属餐厅：</label>
                <div class="col-sm-8">
	                <select id="tzDiningRoom" class="form-control m-b">
						<option th:each="tzDiningRoom:${tzDiningRooms}" th:value="${tzDiningRoom.diningId}" th:text="${tzDiningRoom.diningName}" th:field="*{tzDiningRoom.diningId}"></option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜品图片：</label>
                <div class="col-sm-8">
                    <input name="vagetablesUrl" th:field="*{vagetablesUrl}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜品名称：</label>
                <div class="col-sm-8">
                    <input name="vagetablesName" th:field="*{vagetablesName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜品价格：</label>
                <div class="col-sm-8">
                    <input name="price" th:field="*{price}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜品味道：</label>
                <div class="col-sm-8">
                    <input name="taste" th:field="*{taste}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜品材料：</label>
                <div class="col-sm-8">
                    <input name="materials" th:field="*{materials}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/vagetables";
        $("#form-vagetables-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	var data = $("#form-vagetables-edit").serializeArray();
        		var tzDiningRoomId = $("#tzDiningRoom").val();
        		data.push({"name": "tzDiningId", "value": tzDiningRoomId});
                $.operate.save(prefix + "/edit", data);
            }
        }
    </script>
</body>
</html>